﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace TripleQueue
{
    public partial class FormMain : Form
    {
        private QueueWithThreeCategories queues = new QueueWithThreeCategories();

        private string[] names = { "Arne", "Bengt", "Kalle", "Karin", "Berit", "Anna", "Tage", "Bosse", "Mathilda", "Stig", "Johan", "Johanna", "Hanna",
                                 "Knut", "Siv", "Gun", "Marit", "Jessica", "Olle", "Lars", "Frans", "Ulla", "Roger", "Ronja", "Gustav", "Olivia"};

        private Random rng = new Random();
        public FormMain()
        {
            InitializeComponent();
        }

        private void FormMain_Paint(object sender, PaintEventArgs e)
        {
            queues.Draw(this.CreateGraphics());
        }

        private void queHighPriorityToolStripMenuItem_Click(object sender, EventArgs e)
        {
            queues.AddPerson(new Person(names[rng.Next(names.Count())]), Priority.high);
            this.Invalidate();
        }

        private void queMedPriorityToolStripMenuItem_Click(object sender, EventArgs e)
        {
            queues.AddPerson(new Person(names[rng.Next(names.Count())]), Priority.med);
            this.Invalidate();
        }

        private void queLowPriorityToolStripMenuItem_Click(object sender, EventArgs e)
        {
            queues.AddPerson(new Person(names[rng.Next(names.Count())]), Priority.low);
            this.Invalidate();
        }

        private void servicePersonToolStripMenuItem_Click(object sender, EventArgs e)
        {
            queues.ServicePerson();
            this.Invalidate();
        }
    }
}
